package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.ZsHuishou;
import com.lrkj.back.mapper.ZsHuishouMapper;
import com.lrkj.back.service.ZsHuishouService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("huishouService")
public class ZsHuishouServiceImpl extends ParentServiceImpl<ZsHuishou> implements ZsHuishouService {

    @Autowired
    private ZsHuishouMapper zsHuishouMapper;

    @Override
    public PageInfo<ZsHuishou> findAllHuiShou(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsHuishou> tbList = zsHuishouMapper.findAllHuishou(map);
        PageInfo<ZsHuishou> page = new PageInfo<>(tbList);
        return page;
    }

    @Override
    public List<ZsHuishou> findAllHuishouNoPage(Map<String, Object> map) throws DBException {
        List<ZsHuishou> tbList = zsHuishouMapper.findAllHuishou(map);
        return tbList;
    }

    @Override
    public PageInfo<ZsHuishou> selectByTongji(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsHuishou> tbList = zsHuishouMapper.selectByHuishouTongji(map);
        PageInfo<ZsHuishou> page = new PageInfo<>(tbList);
        return page;
    }

    @Override
    protected DBInterface<ZsHuishou> getDao() throws DBException {
        // TODO Auto-generated method stub
        return zsHuishouMapper;
    }

}
